<?php
namespace ITSociaal\Themes\HuisVanHerstel;

use Paulyg\Autoloader;
use Timber;

const LIBDIR = __DIR__ . "/lib";
const SRCDIR = __DIR__ . "/src";

if (!class_exists(Autoloader::class, false)) {
	require_once LIBDIR . "/Autoloader.php";
}

function do_autoloader($namespaces)
{
	return array_map(
		"call_user_func_array",
		array_fill(
			0,
			count($namespaces),
			[new Autoloader(), "addPsr4"]
		),
		$namespaces
	);
}

do_autoloader([
	[__NAMESPACE__, SRCDIR],
]);

if (!defined("WPINC")) {
	// If WP isn't loaded, do autoloading only
	return;
}

call_user_func(
	function($init, $hookers) {
		$init->installHooks(
			$init->getAllHooks(
				$init->createHookers($hookers)
			)
		);
	},
	new Hooks\Init(),
	[
		Hooks\Formatting::class,
		Hooks\Main::class,
		Hooks\Theme::class,
		Hooks\Timber::class,
	]
);

/* vi:set ts=4 sw=4 noet: */
